﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using Common.Utilities.DLR;

namespace Workflows.Components.Rules
{
    /// <summary>
    /// this class is removed 
    /// </summary>
    //public class RuleDALC
    //{
    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <returns></returns>
    //    public static List<RuleComponent> GetAllRuleComponents()
    //    {
    //        string connStr = ConfigurationManager.ConnectionStrings["Workflow"].ConnectionString;
    //        ORMapping<RuleComponent> orm = new ORMapping<RuleComponent>();
    //        return orm.GetAll(connStr);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <returns></returns>
    //    public static Dictionary<string,List<RuleComponent>> GetAllRuleComponentsByCategories()
    //    {
    //        List<RuleComponent> rules = RuleDALC.GetAllRuleComponents();
    //        Dictionary<string,List<RuleComponent>> rulesByCategory=new Dictionary<string, List<RuleComponent>>();
    //        if(rules !=null && rules.Count >0)
    //        {
    //            foreach(RuleComponent rule in rules)
    //            {
    //                string categoryName = rule.ComponentCategory;
    //                if(rulesByCategory.ContainsKey(categoryName))
    //                {
    //                    List<RuleComponent> ruleList = rulesByCategory[categoryName];
    //                    ruleList.Add(rule);
    //                    rulesByCategory[categoryName] = ruleList;
    //                }
    //                else
    //                {
    //                    List<RuleComponent> ruleList=new List<RuleComponent>();
    //                    ruleList.Add(rule);
    //                    rulesByCategory.Add(categoryName,ruleList);
    //                }
    //            }
    //        }
    //        return rulesByCategory;
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="ruleComponent"></param>
    //    public static void SaveRule(RuleComponent ruleComponent)
    //    {
    //        string connStr = ConfigurationManager.ConnectionStrings["Workflow"].ConnectionString;
    //        ORMapping<RuleComponent> orm = new ORMapping<RuleComponent>();
    //        orm.Update(ref ruleComponent, connStr);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="ruleId"></param>
    //    public static void DeleteRule(Guid ruleId)
    //    {
    //        string connStr = ConfigurationManager.ConnectionStrings["Workflow"].ConnectionString;
    //        ORMapping<RuleComponent> orm = new ORMapping<RuleComponent>();

    //        orm.DeleteObjByKey(connStr, ruleId.ToString());
    //    }
    //}
}
